package com.drmswt.cnCaptcha.server.web.controller;

import com.drmswt.cnCaptcha.server.model.Person;
import com.drmswt.cnCaptcha.server.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangcan2 on 2016/3/23.
 */
@RestController
@RequestMapping("/person")
public class PersonController
{
    @Autowired
    private IPersonService personService;

    @RequestMapping(method = RequestMethod.GET)
    public Person getById(@RequestParam("id") int id)
    {
        return this.personService.getPersonById(id);
    }

    @RequestMapping(method = RequestMethod.POST)
    public boolean addPerson()
    {
        return this.personService.addPerson();
    }
}
